#include "ohos_audio_track.h"

namespace ohoswebrtc {

OHOSAudioTrack::OHOSAudioTrack(
    rtc::scoped_refptr<webrtc::AudioTrackInterface> track, rtc::scoped_refptr<OHOSPeerConnectionFactoryInterface> peer_connection_factory)
    : track_(track),
      peer_connection_factory_(peer_connection_factory) {
  RTC_LOG(LS_INFO) << __FUNCTION__ << ": Ctor";
  id_ = track_->id();
  kind_ = track_->kind();
}

OHOSAudioTrack::~OHOSAudioTrack() {
  RTC_LOG(LS_INFO) << __FUNCTION__ << ": Dtor";
}

void OHOSAudioTrack::SetVolume(double volume) {
  track_->GetSource()->SetVolume(volume);
}

rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> OHOSAudioTrack::track() {
  return track_;
}

rtc::scoped_refptr<webrtc::AudioTrackInterface> OHOSAudioTrack::audio_track() {
  return track_;
}

}  // namespace ohoswebrtc
